home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 September (IDG) / Sep99.iso / Shareware World / Comms & Internet / LinkConverter 1.1.2 / Dialog Director v0.7 / Examples / List Demo.as < prev    next >
Encoding:
Text File  |  1998-01-16  |  2.6 KB  |  64 lines  |  [TEXT/ToyS]

  1. --property l1 : list folder (path to apple menu items folder)
  2. --property l2 : list folder (path to startup items folder)
  3. property l1 : {"Last Name", "Middle Name", "First Name", "Personal Title", "Business Name", "Business Street", "Business City", "Business County", "Business Postal Code", "Business Title", "Home Street", "Home City", "Home County", "Home Postal Code", "Notes", "Phone Type", "Phone Number", "EMail Address", "Country"}
  4. --tell application "FileMaker Pro" to tell database 1 to set l1 to name of every field
  5. property l2 : {}
  6.  
  7. set sortDialog to {size:[500, 166], name:"Sort Database Records", style:movable dialog, contents:[¬
  8.     {class:push button, name:"Sort", bounds:[210, 98, 290, 118]}, ¬
  9.     {class:push button, name:"Done", bounds:[210, 134, 290, 154]}, ¬
  10.     {class:push button, name:"Clear All", bounds:[210, 24, 290, 44]}, ¬
  11.     {class:push button, name:"» Move »", bounds:[210, 60, 290, 80], enabled:[dOr, 5, 6]}, ¬
  12.     {class:list box, contents:l1, bounds:[10, 24, 190, 154], action:4}, ¬
  13.     {class:list box, contents:l2, bounds:[310, 24, 490, 154], action:4}, ¬
  14.     {class:static text, contents:"Fields", bounds:[8, 4, 160, 20]}, ¬
  15.     {class:static text, contents:"Sort Order", bounds:[308, 4, 460, 20]}, ¬
  16.     {class:static text, contents:(current date)'s time string, justification:right, bounds:[400, 4, 490, 20]} ¬
  17.         ]}
  18.  
  19. dd install with grayscale
  20. set d to dd make dialog sortDialog
  21. set mov to true
  22. repeat
  23.     set i to dd interact with user for max ticks 60
  24.     if i = 1 or i = 2 then exit repeat
  25.     if i = 3 then -- Clear All
  26.         set l1 to l1 & l2
  27.         set l2 to []
  28.         dd set contents of item 6 of d to l2
  29.         dd set contents of item 5 of d to l1
  30.     else if i = 4 then
  31.         if mov then -- Move
  32.             set x to dd get value of item 5 of d
  33.             set l2 to l2 & item x of l1
  34.             set l1 to DelItem(l1, x)
  35.             dd set contents of item 5 of d to l1
  36.             dd set contents of item 6 of d to l2
  37.             --dd set value of item 6 of d to length of l2
  38.         else -- Clear
  39.             set x to dd get value of item 6 of d
  40.             set l1 to l1 & item x of l2
  41.             set l2 to DelItem(l2, x)
  42.             dd set contents of item 6 of d to l2
  43.             dd set contents of item 5 of d to l1
  44.         end if
  45.     else if i = 5 then -- List 1
  46.         dd set name of item 4 of d to "» Move »"
  47.         dd set value of item 6 of d to 0
  48.         set mov to true
  49.     else if i = 6 then -- List 2
  50.         dd set name of item 4 of d to "Clear"
  51.         dd set value of item 5 of d to 0
  52.         set mov to false
  53.     end if
  54.     dd set contents of item 9 of d to (current date)'s time string -- Display the time
  55. end repeat
  56. dd uninstall
  57.  
  58. on DelItem(l, i)
  59.     if i = length of l then
  60.         return items 1 thru (i - 1) of l
  61.     else
  62.         return items 1 thru (i - 1) of l & items (i + 1) thru -1 of l
  63.     end if
  64. end DelItem